package com.example.service.user.controller;


import com.example.common.ResponseVO;
import com.example.service.user.model.req.GetUserInfoReq;
import com.example.service.user.model.req.ModifyUserInfoReq;
import com.example.service.user.model.req.UserId;
import com.example.service.user.service.ImUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("v1/user/data")
@Api(tags = "获取用户数据相关接口")
public class ImUserDataController {
    private static Logger logger = LoggerFactory.getLogger(ImUserDataController.class);

    @Autowired
    ImUserService imUserService;

    @GetMapping("/getUserInfo")
    @ApiOperation(value = "获取用户数据")
    public ResponseVO getUserInfo( @RequestBody @Validated GetUserInfoReq req){//@Validated  ,Integer appId
//        req.setAppId(appId);
        return imUserService.getUserInfo(req);
    }

    @GetMapping("/getSingleUserInfo")
    @ApiOperation(value = "获取单个用户数据")
    public ResponseVO getSingleUserInfo( @Validated UserId req){  //  @RequestBody  ,Integer appId
//        req.setAppId(appId);
        return imUserService.getSingleUserInfo(req.getUserId(),req.getAppId());
    }

    @PostMapping("/modifyUserInfo")
    @ApiOperation(value = "修改用户信息")
    public ResponseVO modifyUserInfo(@RequestBody @Validated ModifyUserInfoReq req){  // ,Integer appId
//        req.setAppId(appId);
        return imUserService.modifyUserInfo(req);
    }
}
